#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h> 
#include <stdlib.h> 
#include <string.h> 
#include <math.h> 
#include <ctype.h> 
#include <time.h> 
#include <assert.h>

int main()
{
	int arr[999];
	for (int i = 6; i <= 1000; i++)
	{
		int num = i;
		int count = 0;
		int sum = 0;
		for (int j = 1; j < num; j++)
		{
			if (num % j == 0)
			{
				arr[count] = j;
				count++;
			}
		}
		for (int j = 0; j < count; j++)
		{
			sum += arr[j];
		}
		if (i == sum)
			printf("%d ",i);
	}

	return 0;
}